<?php

class DBGraph extends Graph {
	protected $dbId;
	protected $matrix = null;

	public function __construct($id) {
		$query = 'SELECT * FROM graph WHERE id=' . intval($id) . ' LIMIT 1';
		$graph = $GLOBALS['db']->fetchFirst($query);
		$this->dbId = $id;
		$query = 'SELECT found_chromatic_number FROM chromatic_number WHERE good = 1 AND algorithm = 1 AND graph = ' . intval($id) . ' ORDER BY found_chromatic_number';
		$res = $GLOBALS['db']->fetchFirst($query);
		if ($res) {
			$this->brelazColours = $res['found_chromatic_number'];
		}
		
		$this->matrix = unserialize($graph['matrix']);
		parent::__construct($graph['number_of_vertices']);
	}

	protected function generateMatrix() {
		
	}
	
	public function getDbId() {
		return $this->dbId;
	}

}

?>